package com.software.lease.web.admin.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.software.lease.model.entity.FacilityInfo;
import com.software.lease.model.enums.ItemType;
import com.software.lease.web.admin.service.FacilityInfoService;
import com.software.lease.web.admin.mapper.FacilityInfoMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author liubo
* @description 针对表【facility_info(配套信息表)】的数据库操作Service实现
* @createDate 2023-07-24 15:48:00
*/
@Service
public class FacilityInfoServiceImpl extends ServiceImpl<FacilityInfoMapper, FacilityInfo>
    implements FacilityInfoService{

    @Autowired
    private FacilityInfoMapper facilityInfoMapper;

    @Override
    public List<FacilityInfo> listFacility(ItemType type) {
        if(type == null){
            List<FacilityInfo> list = facilityInfoMapper.selectAll();
            return list;
        }else{
            List<FacilityInfo> list = facilityInfoMapper.selectByType(type);
            return list;

        }
    }

    @Override
    public void deleteById(Long id) {
        facilityInfoMapper.deleteById(id);
    }

    @Override
    public void removeByApartmentId(Long apartmentId) {
        facilityInfoMapper.removeByApartmentId(apartmentId);
    }
}




